place sidebar: minor change
authorMatthias Clasen <mclasen@redhat.com>
Tue, 7 Jul 2015 01:59:10 +0000 (21:59 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 7 Jul 2015 01:59:10 +0000 (21:59 -0400)
We generally prefer for loops to iterate over lists.

gtk/gtkplacessidebar.c

index 5f92fac93bac519d23d5013879ab6482a27b8ca6..54271df8289a6cfc221a85d368bbae53d7c602d6 100644 (file)
@@ -2317,9 +2317,9 @@ rename_entry_changed (GtkEntry         *entry,
       gtk_label_set_label (GTK_LABEL (sidebar->rename_error), "");
       return;
     }
+
   rows = gtk_container_get_children (GTK_CONTAINER (sidebar->list_box));
-  l = rows;
-  while (l != NULL && !found)
+  for (l = rows; l && !found; l = l->next)
     {
       g_object_get (l->data,
                     "place-type", &type,
@@ -2334,15 +2334,12 @@ rename_entry_changed (GtkEntry         *entry,
 
       g_free (uri);
       g_free (name);
-
-      l = l->next;
     }
+  g_list_free (rows);
 
   gtk_widget_set_sensitive (sidebar->rename_button, !found);
   gtk_label_set_label (GTK_LABEL (sidebar->rename_error),
                        found ? _("This name is already taken") : "");
-
-  g_list_free (rows);
 }
 
 static void